package com.ccp.dev.workflow.xml;

import com.ccp.dev.core.util.FileUtil;

import java.io.File;

/**
 * ClassDescribe:导入XML删除文件
 *
 * @author: fanruiqi
 * Date: 2019-10-16
 * Since:1
 * To change this template use File | Settings | File Templates.
 */
public class FileXmlUtil {
    private FileXmlUtil(){};

    /**
     * 写Xml文件
     * @param fileName
     * @param content
     * @param path
     * @return
     */
    public static  String writeXmlFile(String fileName,String content,String path){
        String filePath = createFilePath(path , fileName);
        FileUtil.writeFile(filePath,content);
        return filePath;
    }

    /**
     * 创建文件目录
     * @param tempPath
     * @param fileName 文件名称
     * @return 文件的完整目录
     */
    public static String createFilePath(String tempPath, String fileName){
        File file = new File(tempPath);
        //文件夹不存在创建
        if (!file.exists()) {
            file.mkdirs();
        }
        return file.getPath() + File.separator+ fileName;
    }

}
